package exception;

import java.io.FileNotFoundException;

/**
 * 异常的排出
 */
public class ThrowDemo {
    public static void main(String[] args) {
        /*------------1
        Student zs= new Student();
        zs.setAge(200);
        System.out.println(zs.getAge());*/






        /*Student zs= new Student();
        try {
            zs.setAge(200);
            System.out.println(zs.getAge()+"岁了");
        }catch (Exception e ){
            System.out.println("不合法");
        }*/


        Student zs= new Student();
        try {////////////////以一般出现异常会使用try catch解决
            zs.setAge(20);
        } catch (illegalAgeException e) {
            e.printStackTrace();
        }
        System.out.println(zs.getAge());


    }
}
